מדעי המחשב 2 יחידות לימוד פתרון בחינת הבגרות פרק א. I x > a. פתרון 2: משפט switch

Size: px
Start display at page:

Download "מדעי המחשב 2 יחידות לימוד פתרון בחינת הבגרות פרק א. I x > a. פתרון 2: משפט switch"

Transcription

1 1 מדעי המחשב 2 יחידות לימוד פתרון בחינת הבגרות שאלה פרק א :1 m a b k k b x I x > a II x < b פלט I && II העמודות המסומנות בכחול אינן עמודות חובה בפתרון. שאלה 2: פתרון 2: משפט switch פתרון 1: משפט if שים : משפט return מסיים את ביצוע הפעולה ולכן אין צורך ב- else שים : משפט return מסיים את ביצוע הפעולה ולכן אין צורך ב- break בכל משפט case --- ט. כניסה: מספר הגלגלים של כלי הרכב ---// --- ט.יציאה: מוחזר תו המיצג את סוג הרכב ---// static char vehicle (int n) switch (n) case 4: return 'c'; case 8: return 'b'; default: return 'n'; static char vehicle (int n) if (n == 4) return 'c'; if (n == 8) return 'b'; return 'n';

2 2 שאלה 3: א. טבלת מעקב: x y x y temp פלט x = 7 y = x = 3 y = 7 )x y x ב. = 3 y x = 7 )כל שני מספרים ו - y המקיימים int k = input.nextint(); for (int i = 0 ; i < a.length ; i++) if (a[i] == k) System.out.println(i); שאלה 4: int sum = 0; int a = input.nextint(); int b = input.nextint(); while(a*b!= 0) sum = sum + a*b; a = input.nextint(); b = input.nextint(); System.out.println("sum = " + sum); שאלה 5: הערה: בכל מקום שבו נדרש קטע תכנית, אין צורך להגדיר את אובייקט הקלט Scanner פתרון הבחינה מניח את קיומו של אובייקט הקלט הבא:

3 3 שאלה פרק ב import java.util.scanner; public class argil_6 /** קלט: מספר וסוג הסנדוויץ המבוקש, עם/בלי תוספות * פלט: מחיר ההזמנה, והמחיר אחרי ההנחה * סך ההזמנות ליום העבודה * */ public static void main(string[] args) int count = 0; int kind, top, sum; :6 ;(" <-- הקש מספר הכריכים") System.out.print int num = input.nextint(); while (num!= 0) count ++; System.out.print ;(" <-- הקלד 1 לכריך גבינה לבנה, 2 לגבינה צהובה ") kind = input.nextint(); System.out.print "); --> תוספת עשבי תיבול? - 1 = כן, = 2 לא (" top = input.nextint(); if (kind == 1) sum = num * 10; else sum = num * 12; if (top == 1) sum = sum + num; if (num >= 10) sum = sum - 20; System.out.println("sum = " + sum); ;(" <-- הקש מספר הכריכים") System.out.print num = input.nextint(); System.out.println("count = " + count);

4 4 import java.util.scanner; public class argil_7 /** קלט: חודש ושנת לידה של n תינוקות * פלט: מספר הבנים ומספר הבנות שנולדו * בין ינואר )1( עד )כולל( יוני )6( שנת * 2009 */ שאלה 7: --- ט. כניסה: 2 מספרים שלמים : ראשון חודש שני שנה ---// --- ט.יציאה: "אמת" אם התאריך בזמן הנתון ו-"שקר" אחרת ---// public static boolean indate(int month, int year) boolean correctmonth = month >= 1 && month <= 6; boolean correctyear = year == 2009; return correctmonth && correctyear; אפשרות נוספת: if (month >= 1 && month <= 6 %% year == 2009) return true; return false; public static void main(string[] args) int countboys = 0, countgirls = 0; for (int i = 0 ; i < 1000 ; i++) System.out.print("type month --> "); int month = input.nextint(); System.out.print("type year --> "); int year = input.nextint(); System.out.print ("type B for boy, G for girl --> "); char gender = (char)input.next().charat(0); ראה הערה בהמשך if (indate(month, year)) if (gender == 'b' gender == 'B') countboys ++ ; else countgirls ++ ;

5 5 System.out.println("num of boys = " + countboys); System.out.println("num of girls = " + countgirls); הערה: אפשר להמיר את קלט מין הילד בקלט מספר שונה לבן ולבת, ואז קטע הקוד המסומן יראה כך: System.out.print("type 0 for boy, 1 for girl --> "); int gender = input.nextint(); if (indate(month, year)) if (gender == 0) countboys ++ ; else countgirls ++ ;

6 6 שאלה 8: א. טבלת מעקב arr i k i k num num%2 == 0 arr[i] arr[k] פלט i = 5 k = העמודות המסומנות בכחול אינן עמודות חובה בפתרון. ב. 1, 2, 3, 4, 5, 6, 7, 8 כל סדרה של 8 מספרים הכוללת 4 מספרים זוגיים ו- 4 מספרים אי-זוגיים. ג. 1, 3, 5, 7, 9, 11, 13, 15 כל סדרה של 8 מספרים הכוללת 8 מספרים אי-זוגיים.

7 7 שאלה פרק ג import java.util.scanner; public class argil_9 /** תכנית הסופרת כמה שלשות אלכסוניות ימניות אחידות * במערך הדו- ממדי * */ static int n = 36, m = 52; :9 --- מחזיר שקר אם האינדקסים של השלשה חורגים מגודל המערך ---// --- אמת אם תקין (בודק חריגה מגודל המערך) ---// static boolean tripple (int[][]mat, int i, int j) if (i < 0 i >= mat.length-2) return false; if (j < 0 j >= mat[0].length-2) return false; return true; --- מחזיר 1 אם יש שלשה אלכסונית ימנית אחידה, ו- 0 אחרת ---// public static int isrightripple(int[][]mat, int i, int j) if (! tripple(mat, i, j)) return 0; if (mat[i][j]!=1 mat[i+1][j+1]!=1 mat[i+2][j+2]!=1) return 0; return 1; אפשרות נוספת: int sum = mat[i][j] + mat[i+1][j+1] + mat[i+2][j+2]; if (sum == 3) return 1; return 0; public static void main(string[] args) int[][]mat = new int[n][m]; שתי שורות אלו לא נדרשו במבחן. Matrix.matill(mat); ממימוש המחלקה Matrix בקובץ Matrix.matShow(mat); הפרוייקט המצורף לפתרון. int count = 0; for (int i = 0 ; i < n-2 ; i++) for (int j = 0 ; j < m-2 ; j++) count += isrightripple(mat,i,j); System.out.println("count = " + count);

8 8 import java.util.scanner; public class argil_10 /** מים גועשים * קלט: גיל המבקרים בבריכה * פלט: מספר המבקרים בכל אחד מהמתקנים * */ ---// ט.כניסה: גיל המבקר במתקן שמותר לביקור ---// 1 ט.יציאה: מערך שבו ---// במתקן האסור 0 ו- static int[] allowed(int age) int [] arr = new int[3]; arr[0] = 1; arr[1] = 0; arr[2] = 0; if (age >= 16) arr[1] = 1; if (age >= 18) arr[2] = 1; return arr; public static void main(string[] args) מונה המבקרים במקפצה // 0; = countjumper int מונה המבקרים בג ' קוזי // 0; = countjakuzi int מונה המבקרים בסאונה // 0; = countsauna int System.out.print("type age --> "); int age = input.nextint(); while (age >= 12) int[]a = allowed(age); countjumper += a[0]; countjakuzi += a[1]; countsauna += a[2]; שאלה 10: System.out.print("type age --> "); age = input.nextint(); System.out.println("countJumper = " + countjumper); System.out.println("countJakuzi = " + countjakuzi); System.out.println("countSauna = " + countsauna);

סכום (סדרת ערכים) אחרת - דוגמא: סכום-ספרות (num) אם < 10 num החזר 1 או אם = 0 = num החזר 0 public static int numofdigits (int num)

סכום (סדרת ערכים) אחרת - דוגמא: סכום-ספרות (num) אם < 10 num החזר 1 או אם = 0 = num החזר 0 public static int numofdigits (int num) 1 תבנית צבירה תבניות אלגוריתמיות לפעולות רקורסיביות תבנית צבירה לסדרת ערכים: סכום (סדרת ערכים) החזר את ערך הקצה + סכום (סדרת הערכים ללא ערך הקצה) דוגמא: פעולה המחזירה את סכום הספרות שבמספר שלם לא שלילי

More information

הנכות 1 םוכיס לוגרת 14 1

הנכות 1 םוכיס לוגרת 14 1 תוכנה 1 סיכום תרגול 14 1 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים במנשק הם תמיד מופשטים וציבוריים public interface MyInterface { public abstract int foo1(int i); int foo2(int i); The modifiers

More information

Engineering Programming A

Engineering Programming A Engineering Programming A תרגול 5 25.11.2012 מערכים חד-מימדיים )תזכורת( לדוגמא: מערך בשם Arr בגודל 8 שאיבריו מטיפוס int 3 7 5 6 8 1 23 16 0 1 2 3 4 5 6 7 ב - arr[0] ב יושב ערך שהוא המספר השלם 3 arr[1]

More information

מערכים שעור מס. 4 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1

מערכים שעור מס. 4 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 מערכים שעור מס. 4 דרור טובי דר' כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 למה מערכים? ברצוננו לאחסן בתוכנית ציוני בחינה כדי לחשב את ממוצע הציונים וסטיית התקן. נניח ש 30 סטודנטים לקחו

More information

הפלט אחרי הביצוע של ההוראה :what3(root)

הפלט אחרי הביצוע של ההוראה :what3(root) שאלה )18 1 נקודות( סעיף א. )11 נקודות( הפלט אחרי הביצוע של ההוראה :what3(root) 15 10 20 26 12 18 25 3 28 14 13 סעיף ב. )3 נקודות( הפונקציה what1 מוסיפה את האיבר node בסוף הרשימה ומעדכנת את ראש הרשימה *ph

More information

מבוא למדעי המחשב תרגול 5: לולאות ומערכים

מבוא למדעי המחשב תרגול 5: לולאות ומערכים מבוא למדעי המחשב תרגול 5: לולאות ומערכים תוכנייה לולאת while, do while, for מערכים מערכים דו ממדיים 2 לולאות 3 תזכורת: לולאת while גוף הלולאה מתבצע שוב ושוב כל עוד התנאי מתקיים int number; scanf( %d, &number);

More information

Algorithms. Intro2CS week 5

Algorithms. Intro2CS week 5 Algorithms Intro2CS week 5 1 Computational problems A computational problem specifies an inputoutput relationship What does the input look like? What should the output be for each input? Example: Input:

More information

שאלה 1, סעיף ב )11 נק'(

שאלה 1, סעיף ב )11 נק'( שאלה 1, סעיף א )8 נק'( public static boolean lexlt(string s1, String s2) for (int i=0; i

More information

לתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions

לתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions מבוא לתיכנות עם MATLAB 234127 Lecture 5: Boolean logic and Boolean expressions Written by Prof. Reuven Bar-Yehuda, Technion 2013 Based on slides of Dr. Eran Eden, Weizmann 2008 1 >>g = [89 91 80 98]; >>p

More information

ITERATION WEEK 4: EXMAPLES IN CLASS

ITERATION WEEK 4: EXMAPLES IN CLASS Monday Section 2 import java.util.scanner; public class W4MSection2 { ITERATION WEEK 4: EXMAPLES IN CLASS public static void main(string[] args) { Scanner input1 = new Scanner (System.in); int CircleCenterX

More information

משתנים שעור מס. 2 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1

משתנים שעור מס. 2 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 משתנים שעור מס. 2 דרור טובי דר' כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 תפקיד המשתנים הצהרה על משתנה השמת ערך במשתנה int a, b, c; a = 1234; b = 99; c = a + b; משתנים מאפשרים לנו לשמור

More information

שאלה 1 מהו הפלט של התוכנית הבאה:

שאלה 1 מהו הפלט של התוכנית הבאה: תרגול חזרה שאלה 1 מהו הפלט של התוכנית הבאה: public sttic int wht(int n) { int i; int sum=0; if(n == 0) return 1; for (i=0; i

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 2 Section 001 Fall 2014 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

CSE 20 Intro to Computing I. Coding

CSE 20 Intro to Computing I. Coding CSE 0 Intro to Computing I Coding ChooseFunc.java for (int i = ; i

More information

מבוא לתכנות ב- JAVA תרגול 7

מבוא לתכנות ב- JAVA תרגול 7 מבוא לתכנות ב- JAVA תרגול 7 רקורסיה - הקדמה הגדרה רקורסיבית: חדר הוא מסודר אם צד שמאל שלו מסודר שלו מסודר. וצד ימין שיטת פתרון רקורסיבית: פתרון מופעים פשוטים יותר של בעיה בכדי לפתור את הבעיה המקורית רקורסיה

More information

לתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions

לתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions מבוא לתיכנות עם MATLAB 23427 Lecture 5: Boolean logic and Boolean expressions Written by Prof. Reuven Bar-Yehuda, Technion 203 Based on slides of Dr. Eran Eden, Weizmann 2008 ביטויים לוגיים דוגמא: תקינות

More information

מצליחה. 1. int fork-bomb() 2. { 3. fork(); 4. fork() && fork() fork(); 5. fork(); printf("bla\n"); 8. return 0; 9. }

מצליחה. 1. int fork-bomb() 2. { 3. fork(); 4. fork() && fork() fork(); 5. fork(); printf(bla\n); 8. return 0; 9. } שאלה : (4 נקודות) א. ב. ג. (5 נקודות) הגדירו את המונח race-condition במדוייק לא להשמיט פרטים. ספקו דוגמא. (5 נקודות) מהו? Monitor נא לספק הגדרה מלאה. ( נקודות) ( נקודות) ציינו כמה תהליכים יווצרו בקוד הבא

More information

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1 Name SOLUTION Page Points Score 2 15 3 8 4 18 5 10 6 7 7 7 8 14 9 11 10 10 Total 100 1 P age 1. Program Traces (41 points, 50 minutes)

More information

לתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions

לתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions מבוא לתיכנות עם MATLAB 234127 Lecture 5: Boolean logic and Boolean expressions Written by Prof. Reuven Bar-Yehuda, Technion 2013 Based on slides of Dr. Eran Eden, Weizmann 2008 1 motivation Proper academic

More information

It is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff();

It is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff(); COSC 117 Exam 3 Key Fall 2012 Part 1: Definitions & Short Answer (3 Points Each) 1. A method in a class that has no return type and the same name as the class is called what? How is this type of method

More information

הנכות 1 םוכיס לוגרת 13 1

הנכות 1 םוכיס לוגרת 13 1 תוכנה 1 סיכום תרגול 13 1 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים במנשק הם תמיד מופשטים וציבוריים public interface MyInterface { public abstract int foo1(int i); int foo2(int i); The modifiers

More information

מבוא למדעי המחשב תרגול 8 רשימה משורשרת כללית, Comparator

מבוא למדעי המחשב תרגול 8 רשימה משורשרת כללית, Comparator מבוא למדעי המחשב 2017 תרגול 8 רשימה משורשרת כללית, Comparator בתרגול היום. LinkedList בניית ההכללה מ- LinkIntList תרגול המבנה ושימושיו ממשקים: Comparator Sorted Linked List ל- LinkedList ע"י שימוש ב- Comparator

More information

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade; Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The

More information

Amortized Analysis, Union-Find,

Amortized Analysis, Union-Find, Practical Session No. 13 Amortized Analysis, Union-Find, AMORTIZED ANALYSIS Refers to finding the average running time per operation, over a worst-case sequence of operations. Amortized analysis differs

More information

2. (לדוגמא: יחידת הספריה (my_unit.c. #include "my_unit.c" היחידה (חלק ה-.(prototype לדוגמא:. my_unit.h הכותר. הוראת מדעי המחשב, אוניברסיטת תל-אביב

2. (לדוגמא: יחידת הספריה (my_unit.c. #include my_unit.c היחידה (חלק ה-.(prototype לדוגמא:. my_unit.h הכותר. הוראת מדעי המחשב, אוניברסיטת תל-אביב 3. יחידת ספריה ופרויקט C ב- יחידת הלימוד "עיצוב תוכנה" עוסקת בנושא הפיתוח והעיצוב של מערכות. חלק מעקרונות הפיתוח הם: תכנון מהפרט אל הכלל, חלוקה למודולים ועבודת צוותים על פי ממשקים ברורים. מערכת אחת יכולה

More information

תרגול 4 פונקציות. מבנה של פונקציה: public static <return value type> <function name> (<arg1 type> <arg1>, <arg2 type> <arg2>, ) { <function body> }

תרגול 4 פונקציות. מבנה של פונקציה: public static <return value type> <function name> (<arg1 type> <arg1>, <arg2 type> <arg2>, ) { <function body> } נושאי התרגול: מה הן פונקציות הגדרת פונקציה,קריאה לפונקציה העברת ארגומנטים,החזרת ערך או void העברת משתנים פרימיטיביים ומערכים לפונקציה העמסה של פונקציות תרגול 4 פונקציות מוטיבציה לעיתים,אנו נזקקים לבצע

More information

public class B { private int f = 0; public static void main(string[] args) { B b1 = new B(); B b2 = new B(); Object b3 = b1;

public class B { private int f = 0; public static void main(string[] args) { B b1 = new B(); B b2 = new B(); Object b3 = b1; main /***/ public class B { private int f = 0; public static void main(string[] args) { B b1 = new B(); B b2 = new B(); Object b3 = b1; System.out.println(/***/); @Override public boolean equals(object

More information

Iteration statements - Loops

Iteration statements - Loops Iteration statements - Loops : ) הוראות חזרה / לולאות ( statements Java has three kinds of iteration WHILE FOR DO... WHILE loop loop loop Iteration (repetition) statements causes Java to execute one or

More information

Arrays. Eng. Mohammed Abdualal

Arrays. Eng. Mohammed Abdualal Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 9 Arrays

More information

גיליון תשובות מספר נבחן: סעיף ג (10 נקודות) הגדרת בטיחות הינה שמירה על האינווריאנטה של האובייקטים במהלך ההרצה.

גיליון תשובות מספר נבחן: סעיף ג (10 נקודות) הגדרת בטיחות הינה שמירה על האינווריאנטה של האובייקטים במהלך ההרצה. גיליון תשובות מספר נבחן: (30 נקודות) שאלה 1 סעיף א (15 נקודות) remove() המתודה remove() גם משנה את מצב האובייקט,(command) וגם מחזירה ערך.(query) על פי עקרונות העיצוב שלמדנו בכיתה יש להפריד שאילתות מפקודות.

More information

תוכנה 1 סמסטר א' תשע"א

תוכנה 1 סמסטר א' תשעא General Tips on Programming תוכנה 1 סמסטר א' תשע"א תרגול מס' 6 מנשקים, דיאגרמות וביטים * רובי בוים ומתי שמרת Write your code modularly top-down approach Compile + test functionality on the fly Start with

More information

CS141 Programming Assignment #6

CS141 Programming Assignment #6 CS141 Programming Assignment #6 Due Sunday, Nov 18th. 1) Write a class with methods to do the following output: a) 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1 b) 1 2 3 4 5 4 3 2 1 1 2 3 4 * 4 3 2 1 1 2 3 * * * 3 2 1

More information

Operating Systems. Practical Session 4 Threads

Operating Systems. Practical Session 4 Threads Operating Systems Practical Session 4 Threads 1 Threads Executed within a process. Allow multiple independent executions under the same process (container). Possible states: running, ready, blocked, terminated.

More information

הנכות 1 םוכיס לוגרת 13 1

הנכות 1 םוכיס לוגרת 13 1 תוכנה 1 סיכום תרגול 13 1 בחינה באופק! הבחינה תכלול את כל הנושאים שכיסינו במהלך הסמסטר: כל ההרצאות כל תרגולים כל תרגילי בית חומר סגור שאלות אמריקאיות 2 קצת על מנשקים מנשק יכול להרחיב שירותים במנשק הם תמיד

More information

גיליון תשובות מספר נבחן:

גיליון תשובות מספר נבחן: גיליון תשובות מספר נבחן: 03( שאלה 1 סעיף א )02 (i) //@PRE: checkinv(other.getx(),other.gety(),other.getradius()) //@POST: getradius() other.getradius() >= // Math.max(Math.abs(getY()-other.getY()),Math.abs(getX()-

More information

פתרון מוצע לבחינת מה"ט ב_שפת c מועד אביב תשע"ח, פברואר 8102 מחבר: מר שייקה בילו, מכללת אורט רחובות

פתרון מוצע לבחינת מהט ב_שפת c מועד אביב תשעח, פברואר 8102 מחבר: מר שייקה בילו, מכללת אורט רחובות פתרון מוצע לבחינת מה"ט ב_שפת c מועד אביב תשע"ח, פברואר 8102 מחבר: מר שייקה בילו, מכללת אורט רחובות שאלה מספר 1 התוכנית מגדירה חמישה משתנים שלמים: השלושה הראשונים הם שלושה מצביעים - *s *t,i. j ושלושה נוספים

More information

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks: كلية الحاسبات وتقنية المعلوما Exam 2 Programming I (CPCS 202) Instructor: M. G. Abbas Malik Date: November 22, 2015 Student Name: Student ID: Total Marks: 40 Obtained Marks: Instructions: Do not open this

More information

מבוא לתכנות ב- JAVA מעבדה 3. Ipc161-lab3

מבוא לתכנות ב- JAVA מעבדה 3. Ipc161-lab3 מבוא לתכנות ב- JAVA מעבדה 3 Ipc161-lab3 נושאי התרגול ניפוי שגיאות לולאות בדיקת תרגילים בקורס )השוואת פלטים למול הפתרון המצופה( כיצד להפנות את פלט התוכנית לקובץ טקסט איך להשוות תכנים של שני קבצים בעזרת

More information

קורס תכנות שיעור שני: שימוש במשתנים,

קורס תכנות שיעור שני: שימוש במשתנים, קורס תכנות שיעור שני: שימוש במשתנים, בקרת זרימה, לולאות 1 נושאי השיעור היום משתנים )variables( טיפוסי משתנים בשפת C הגדרת משתנים השמה למשתנים פעולות על משתנים קליטת ערכים מהמשתמש הדפסה משתנים בקרת זרימה

More information

מבוא למדעי המחשב תרגול 13: עצים בינאריים

מבוא למדעי המחשב תרגול 13: עצים בינאריים מבוא למדעי המחשב תרגול 13: עצים בינאריים עצים בינאריים - הגדרה הגדרה: עץ בינארי הוא עץ ריק (בלי צמתים) או עץ המורכב משורש ושני תתי-עצים, הוא עץ בינארי. ימני ושמאלי, שכל אחד מהם תרגיל 1 עץ בינארי מסודר

More information

Exams questions examples

Exams questions examples Exams questions examples 1 Exam example 1. y - x what נק' ( לפניך הפעולה הרקורסיבית מקבלת כפרמטרים שני מספרים שלמים ו 10 )? מה יהיה הפלט כתוצאה מזימון הפעולה what public static int what(int x, int y) if(x

More information

1 Short Answer (10 Points Each)

1 Short Answer (10 Points Each) 1 Short Answer (10 Points Each) 1. Write a for loop that will calculate a factorial. Assume that the value n has been input by the user and have the loop create n! and store it in the variable fact. Recall

More information

CPSC 219 Extra review and solutions

CPSC 219 Extra review and solutions CPSC 219 Extra review and solutions Multiple choice questions: Unless otherwise specified assume that all necessary variable declarations have been made. For Questions 1 6 determine the output of the print()

More information

כתבו קוד ב- 3 קבצי ה hpp (כתבו כהערה את שם הקובץ מעל) כך שהקוד יהיה תקין ובסגנון טוב. אין חובה

כתבו קוד ב- 3 קבצי ה hpp (כתבו כהערה את שם הקובץ מעל) כך שהקוד יהיה תקין ובסגנון טוב. אין חובה פקולטה: מדעי הטבע מחלקה: מדעי המחשב שם הקורס: מבנה זכרון ושפת ++C קוד הקורס: 7027810 תאריך בחינה: שאלות לדוגמא משך הבחינה: שעתיים שם המרצים: ד"ר אופיר פלא, ד"ר מירי בן ניסן חומר עזר: פתוח שימוש במחשבון:

More information

שים לב! אין לכתוב בשוליים. השוליים יחתכו לצורך סריקת המבחן.

שים לב! אין לכתוב בשוליים. השוליים יחתכו לצורך סריקת המבחן. מספר : 804042 שם המרצה: תאריך הבחינה: ד"ר גדעון גרדוול, ד"ר אריאלה ריכרדסון 13/02/2013 משך הבחינה )בדקות(: 150 חומר עזר מותר לשימוש: ללא חומר עזר מחשבון: ללא מחשבון מס' תלמיד: מכון: לב/נוה, טל, טל-דעת,

More information

גיליון תשובות על תשובות ריקות יינתן 20% מהניקוד!

גיליון תשובות על תשובות ריקות יינתן 20% מהניקוד! גיליון תשובות על תשובות ריקות יינתן 20% מהניקוד! מספר נבחן: 30( שאלה 1 סעיף א )7 שני ת'רדים המפעילים את מתודת ה move על אחד משני גלגלים סמוכים מסוג SimpleGear הת'רד הראשון תופס את הגלגל הראשון this( שלו(,

More information

Midterm Examination (MTA)

Midterm Examination (MTA) M105: Introduction to Programming with Java Midterm Examination (MTA) Spring 2013 / 2014 Question One: [6 marks] Choose the correct answer and write it on the external answer booklet. 1. Compilers and

More information

Practical Session - Heap

Practical Session - Heap Practical Session - Heap Heap Heap Maximum-Heap Minimum-Heap Heap-Array A binary heap can be considered as a complete binary tree, (the last level is full from the left to a certain point). For each node

More information

במידה ולסעיף ניתנה תשובה ובנוסף נרשם לגבי הסעיף לא יודע/ת אזי הניקוד שיינתן

במידה ולסעיף ניתנה תשובה ובנוסף נרשם לגבי הסעיף לא יודע/ת אזי הניקוד שיינתן פקולטה: מדעי הטבע מחלקה: מדעי המחשב שם הקורס: מבוא למחשבים ושפת C קוד הקורס: 2-7028510 תאריך בחינה: שאלות חזרה למבחן. חשוב: אין להסיק ששאלות אחרות לא יכולות להישאל במבחן, אין להסיק כי נושאים מסויימים בסיליבוס

More information

מבוא לתכנות ב- JAVA מעבדה 4

מבוא לתכנות ב- JAVA מעבדה 4 מבוא לתכנות ב- JAVA מעבדה 4 מה בתרגול מערכים מחרוזות מערך חד מימדי מערך הוא מבנה המחזיק סדרה של איברים מאותו טיפוס גודל המערך הוא קבוע )נקבע בעת יצירת המערך( הגישה לכל איבר היא באמצעות אינדקס למה לי מערך?

More information

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Loop through Arrays. Array Creation and Initialization

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Loop through Arrays. Array Creation and Initialization מערכים תוכנה 1 Array: A fixed-length data structure for storing multiple values of the same type Example from last week: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5 6 7 תרגול 2: מערכים

More information

Tutorial # 4. Q1. Evaluate the logical (Boolean) expression in the following exercise

Tutorial # 4. Q1. Evaluate the logical (Boolean) expression in the following exercise Tutorial # 4 Q1. Evaluate the logical (Boolean) expression in the following exercise 1 int num1 = 3, num2 = 2; (num1 > num2) 2 double hours = 12.8; (hours > 40.2) 3 int funny = 7; (funny!= 1) 4 double

More information

9. טופס הזמנת מוצרים טופס ההזמנה הוא טופס מורכב. מעורבים בו 4 טבלאות נתונים. קשרי הגומלין בין הטבלאות : הטופס :

9. טופס הזמנת מוצרים טופס ההזמנה הוא טופס מורכב. מעורבים בו 4 טבלאות נתונים. קשרי הגומלין בין הטבלאות : הטופס : 9. טופס הזמנת מוצרים טופס ההזמנה הוא טופס מורכב. מעורבים בו 4 טבלאות נתונים. קשרי הגומלין בין הטבלאות : הטופס : 1 בהרצה : הוספת פריט רשימת פריטים ההכנה לעבודה : 1. להוסיף שתי טבלאות למאגר טבלת orders וטבלת.orderDetail

More information

Tasks for fmri-setting (Tasks of first and second pilot study at the end)

Tasks for fmri-setting (Tasks of first and second pilot study at the end) Tasks for fmri-setting (Tasks of first and second pilot study at the end) 1. Faculty int result = 1; int x = 4; while (x > 1) { result = result * x; x--; 7. Find max in list of numbers public static void

More information

רזח יליגרתו םי יראני ב ם

רזח יליגרתו םי יראני ב ם מבוא למדעי המחשב עצים בינאריים ותרגילי חזרה תרגול 13: עצים בינאריים - הגדרה הגדרה: עץ בינארי הוא עץ ריק )בלי צמתים( או עץ המורכב משורש ושני תתי-עצים, הוא עץ בינארי. ימני ושמאלי, שכל אחד מהם שאלה עץ בינארי

More information

1 Short Answer (10 Points Each)

1 Short Answer (10 Points Each) 1 Short Answer (10 Points Each) 1. For the following one-dimensional array, show the final array state after each pass of the three sorting algorithms. That is, after each iteration of the outside loop

More information

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Array Creation and Initialization. Loop through Arrays

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Array Creation and Initialization. Loop through Arrays מערכים Array: A fixed-length data structure for storing multiple values of the same type תוכנה 1 Example: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5 6 7 odds: 1 3 5 7 9 11 13 15 odds.length

More information

תוכנה 1 3 תרגול מס' מערכים ומבני בקרה

תוכנה 1 3 תרגול מס' מערכים ומבני בקרה תוכנה 1 3 תרגול מס' מערכים ומבני בקרה מערכים Array: A fixed-length data structure for storing multiple values of the same type Example: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5 6 7 odds:

More information

הנכות 1 םוכיס לוגרת 13 1

הנכות 1 םוכיס לוגרת 13 1 תוכנה 1 סיכום תרגול 13 1 בחינה באופק! הבחינה תכלול את כל הנושאים שכיסינו במהלך הסמסטר: כל ההרצאות כל תרגולים כל תרגילי בית חומר סגור שאלות אמריקאיות 2 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים

More information

תור שימושים בעולם התוכנה

תור שימושים בעולם התוכנה מבוא למדעי המחשב הרצאה : Queue, Iterator & Iterable תור מבנה נתונים אבסטרקטי תור שימושים בעולם התוכנה השימושים של תורים בעולם התוכנה מזכירים מאוד תורים במציאות: )VoIP( )YouTube( מקלדת שידור סרט באינטרנט

More information

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 Question One: Choose the correct answer and write it on the external answer booklet. 1. Java is. a. case

More information

קורס תכנות שיעור שישי: מחרוזות, מצביעים

קורס תכנות שיעור שישי: מחרוזות, מצביעים קורס תכנות שיעור שישי: מחרוזות, מצביעים מערכים אוסף סדור של משתנים מאותו סוג המשתנים נמצאים ברצף בזיכרון העברת מערך לפונקציה Define רקורסיה במערך מערכים דו מימדיים 2 מחרוזות מהי מחרוזת? רצף של תוים ייצוג

More information

<exp> ::= <define> <cexp> <define> ::= ( define <var-decl> <cexp> ) / DefExp(var:VarDecl, val:cexp)

<exp> ::= <define> <cexp> <define> ::= ( define <var-decl> <cexp> ) / DefExp(var:VarDecl, val:cexp) הנחיות כלליות: תאריך הבוחן: 10.5.2018 שם המרצה: מני אדלר,מיכאל אלחדד, ירון גונן מבחן בקורס: עקרונות שפות תכנות מס' קורס: 202-1-2051 מיועד לתלמידי: מדעי המחשב והנדסת תוכנה שנה: ב' סמסטר: ב' משך הבוחן: 2

More information

University of Palestine. Mid Exam Total Grade: 100

University of Palestine. Mid Exam Total Grade: 100 First Question No. of Branches (5) A) Choose the correct answer: 1. If we type: system.out.println( a ); in the main() method, what will be the result? int a=12; //in the global space... void f() { int

More information

מבוא לתכנות בשפת C. Tzachi (Isaac) Rosen

מבוא לתכנות בשפת C. Tzachi (Isaac) Rosen מבוא לתכנות בשפת C מצביעים והקצאה דינאמית כתובות של משתנים לכל משתנה כתובת של המקום שלו בזיכרון כבר ראינו: שם של מערך הוא למעשה הכתובת של התא הראשון )באינדקס 0( של המערך להזכירכם: תא של מערך הינו משתנה

More information

לאחר הרצת התכנית יופיע בחלון הoutput הפלט הבא: run: ******************************* *****Welcome to Java!***** *******************************

לאחר הרצת התכנית יופיע בחלון הoutput הפלט הבא: run: ******************************* *****Welcome to Java!***** ******************************* דוגמה 1: public class Hello { 2: public static void main(string[] args) { 3: System.out.println("*******************************"); 4: System.out.println("*******Welcome to Java!********"); 5: System.out.println("*******************************");

More information

הוראות לנבחן סף ובהם שמונה שאלות. עליך לענות על שש שאלות, על פי ההנחיות בכל פרק. גמר לבתי ספר לטכנאים ולהנדסאים

הוראות לנבחן סף ובהם שמונה שאלות. עליך לענות על שש שאלות, על פי ההנחיות בכל פרק. גמר לבתי ספר לטכנאים ולהנדסאים גמר לבתי ספר לטכנאים ולהנדסאים סוג הבחינה: מדינת ישראל אביב תשע"ב, 2012 מועד הבחינה: משרד החינוך 714001 סמל השאלון: תכנות מערכות בשפת C ושפת סף הוראות לנבחן א. משך הבחינה: ארבע שעות. ב. מבנה השאלון ומפתח

More information

לוח מבחנים מבוסס על דף עבודה ממקור לא ידוע. פעולה בונה היוצרת לוח מבחנים )ריק(. void Add (Test t)

לוח מבחנים מבוסס על דף עבודה ממקור לא ידוע. פעולה בונה היוצרת לוח מבחנים )ריק(. void Add (Test t) 1 לוח מבחנים מבוסס על דף עבודה ממקור לא ידוע 1. המחלקה מבחן Test מגדירה מבחן לפי תרשים uml הבא: להלן ממשק המחלקה Test תיאור הפעולה פעולה בונה היוצרת מבחן במקצוע subject ובתאריך date פעולה המחזירה מקצוע

More information

Date: Dr. Essam Halim

Date: Dr. Essam Halim Assignment (1) Date: 11-2-2013 Dr. Essam Halim Part 1: Chapter 2 Elementary Programming 1 Suppose a Scanner object is created as follows: Scanner input = new Scanner(System.in); What method do you use

More information

עמוד 1 (תאריך ( âùéä ער äìàù בכל השאלות ניתן להניח שהקלט תקין. 100 íåëñ חורף :

עמוד 1 (תאריך ( âùéä ער äìàù בכל השאלות ניתן להניח שהקלט תקין. 100 íåëñ חורף : עמוד 1 מבוא למדעי המחשב מ' 234114 מבוא למדעי המחשב ח' 234117 מבחן מועד א', סמסטר חורף תשס"ב (תאריך ( 29.1.03 שם משפחה שם פרטי מס' סטודנט âùéä ער äìàù 15 1 15 2 16 3 18 4 16 5 20 6 100 íåëñ חומר עזר: אין

More information

! definite loop: A loop that executes a known number of times. " The for loops we have seen so far are definite loops. ! We often use language like

! definite loop: A loop that executes a known number of times.  The for loops we have seen so far are definite loops. ! We often use language like Indefinite loops while loop! indefinite loop: A loop where it is not obvious in advance how many times it will execute.! We often use language like " "Keep looping as long as or while this condition is

More information

מבוא למדעי המחשב תירגול 3:

מבוא למדעי המחשב תירגול 3: מבוא למדעי המחשב תירגול 3: לולאות, קלט, וטיפוסים תוכנייה לולאת while קלט טיפוסי משתנים המרת טיפוסים טיפוס char מבוא למדעי המחשב מ' - תירגול 3 2 לולאת while מבוא למדעי המחשב מ' - תירגול 3 3 לולאת while

More information

Problems with simple variables

Problems with simple variables Problems with simple variables Hard to give up values high number of variables. Complex to sort a high number of variables by value. Impossible to use loops. Example problem: Read one hundred numbers,

More information

import java.util.scanner; public class Assigment12 { int decnumber; public Assigment12(int number,int base){ if (base == 10) this.decnumber = number;

import java.util.scanner; public class Assigment12 { int decnumber; public Assigment12(int number,int base){ if (base == 10) this.decnumber = number; import java.util.scanner; public class Assigment12 { int decnumber; public Assigment12(int number,int base){ if (base == 10) this.decnumber = number; if (base == 2) this.decnumber = bin2dec(number); if

More information

Repetition, Looping. While Loop

Repetition, Looping. While Loop Repetition, Looping Last time we looked at how to use if-then statements to control the flow of a program. In this section we will look at different ways to repeat blocks of statements. Such repetitions

More information

הנכות 1 תואיגש םע תודדומתהו תואלול,םי : כרעמ 2 לוגרת

הנכות 1 תואיגש םע תודדומתהו תואלול,םי : כרעמ 2 לוגרת תוכנה 1 תרגול 2: מערכים, לולאות והתמודדות עם שגיאות מערכים מערכים Array: A fixed-length data structure for storing multiple values of the same type Example from last week: An array of odd numbers: Indices

More information

תרגול מספר 3: מערכים

תרגול מספר 3: מערכים היום בתרגול:.1.2 תרגול מספר 3: מערכים מערך חד-מימדי: מה זה מערך ולמה צריך אותו? איך מגדירים? איך זה נראה בזכרון? דוגמאות לשימוש במערך חד-מימדי השוואה בין משתנה פרימיטיבי למשתנה שאינו פרימיטיבי מערך דו-מימדי:

More information

Problems with simple variables

Problems with simple variables Arrays Java programming language provides a data structure called the array ( מערך ), which can store a fixed-size sequential collection of elements of the same type. Arrays are widely used within Java

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II 1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1: Introduction Lecture Contents 2 Course info Why programming?? Why Java?? Write once, run anywhere!! Java basics Input/output Variables

More information

Esc101 Mid Semester Exam - II

Esc101 Mid Semester Exam - II Esc101 Mid Semester Exam - II Time Allowed: 1 Hour Max Marks: 75 Instructions: 1. Do not turn this page until the bell rings. 2. YOU MUST WRITE YOUR NAME, ROLL NUMBER & SECTION ON EACH SHEET. 3. Please

More information

Objectives of the lesson

Objectives of the lesson Learning Outcome 1) DEMONSTRATE KNOWLEDGE AND UNDERSTANDING OF THE PROCEDURAL APPROACH TO SOFTWARE DEVELOPMENT. Knowledge & Understanding 2) DEVELOP A PROBLEM BASED STRATEGY FOR CREATING AND APPLYING PROGRAMMED

More information

תוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes

תוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes תוכנה 1 תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes class Outer { static class NestedButNotInner {... class Inner {... מחלקות מקוננות NESTED CLASSES 2 מחלקה מקוננת Class) )Nested

More information

Loops. CSE 114, Computer Science 1 Stony Brook University

Loops. CSE 114, Computer Science 1 Stony Brook University Loops CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Motivation Suppose that you need to print a string (e.g., "Welcome to Java!") a user-defined times N: N?

More information

COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz

COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz The in-class quiz is intended to give you a taste of the midterm, give you some early feedback about

More information

תזכורת: עץבינארי מבוא למדעי המחשב הרצאה 24: עצי חיפוש בינאריים

תזכורת: עץבינארי מבוא למדעי המחשב הרצאה 24: עצי חיפוש בינאריים מבוא למדעי המחשב הרצאה 2: עצי חיפוש בינאריים תזכורת: עץבינארי בנוסףלרשימהמקושרת ומערך, הצגנומבנהנתונים קונקרטיחדש עץבינארי עץבינארימורכבמ: שורש תת-עץשמאלי תת-עץימני A B C D E F G 2 תזכורת: שורש ותתי-עצים

More information

Tutorial 11. Exercise 1: CSC111 Computer Programming I. A. Write a code snippet to define the following arrays:

Tutorial 11. Exercise 1: CSC111 Computer Programming I. A. Write a code snippet to define the following arrays: College of Computer and Information Sciences CSC111 Computer Programming I Exercise 1: Tutorial 11 Arrays: A. Write a code snippet to define the following arrays: 1. An int array named nums of size 10.

More information

הוראות לנבחן גמר לבתי ספר לטכנאים ולהנדסאים סמל השאלון: תכנות מערכות ושפת סף ההנחיות בשאלון זה מנוסחות בלשון זכר, אך מכוונות לנבחנות ולנבחנים כאחד.

הוראות לנבחן גמר לבתי ספר לטכנאים ולהנדסאים סמל השאלון: תכנות מערכות ושפת סף ההנחיות בשאלון זה מנוסחות בלשון זכר, אך מכוונות לנבחנות ולנבחנים כאחד. גמר לבתי ספר לטכנאים ולהנדסאים סוג הבחינה: מדינת ישראל אביב תשס"ז, 2007 מועד הבחינה: משרד החינוך 714001 סמל השאלון: תכנות מערכות ושפת סף הוראות לנבחן א. משך הבחינה: ארבע שעות. ב. מבנה השאלון ומפתח ההערכה:

More information

Loops. Eng. Mohammed Abdualal. Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department

Loops. Eng. Mohammed Abdualal. Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 6 Loops

More information

פתרון מוצע לבחינה בשפת C של מה"ט מועד אביב תשע"ז, פברואר 2017 מחבר: מר עסאקלה שאדי, מכללת אורט בראודה

פתרון מוצע לבחינה בשפת C של מהט מועד אביב תשעז, פברואר 2017 מחבר: מר עסאקלה שאדי, מכללת אורט בראודה פתרון מוצע לבחינה בשפת C של מה"ט מועד אביב תשע"ז, פברואר 2017 מחבר: מר עסאקלה שאדי, מכללת אורט בראודה שאלה מספר 1 נתונה התכנית הבאה בשפת C: #include #define SUM_OF_3(x,y,z) x+y+z #define AVRG_OF_3(x,y,z)

More information

תוכנה 1 תרגול 2: מערכים ומבני בקרה

תוכנה 1 תרגול 2: מערכים ומבני בקרה תוכנה 1 תרגול 2: מערכים ומבני בקרה 2 Useful Eclipse Shortcuts Ctrl+1 quick fix for errors, or small refactoring suggestions Ctrl+SPACE code content assist (auto-completion) Auto completion for main create

More information

1. An operation in which an overall value is computed incrementally, often using a loop.

1. An operation in which an overall value is computed incrementally, often using a loop. Practice Exam 2 Part I: Vocabulary (10 points) Write the terms defined by the statements below. 1. An operation in which an overall value is computed incrementally, often using a loop. 2. The < (less than)

More information

מבוא למדעי המחשב תירגול 2: מבוא למדעי המחשב מ' - תירגול 2

מבוא למדעי המחשב תירגול 2: מבוא למדעי המחשב מ' - תירגול 2 מבוא למדעי המחשב תירגול 2: לולאות, קלט, וטיפוסים 1 תוכנייה לולאת while קלט טיפוסי משתנים המרת טיפוסים טיפוס char 2 לולאת while 3 לולאת while קטע קוד מתבצע שוב ושוב כל עוד תנאי מתקיים int number = 40; while(number>0)

More information

CSE 20. SAMPLE FINAL Version A Time: 180 minutes. The following precedence table is provided for your use:

CSE 20. SAMPLE FINAL Version A Time: 180 minutes. The following precedence table is provided for your use: CSE 20 SAMPLE FINAL Version A Time: 180 minutes Name The following precedence table is provided for your use: Precedence of Operators ( ) - (unary),!, ++, -- *, /, % +, - (binary) = = =,!= &&

More information

הנכות 1 תואיגש םע תודדומתהו תואלול,םיכרעמ : לו 2 גרת

הנכות 1 תואיגש םע תודדומתהו תואלול,םיכרעמ : לו 2 גרת תוכנה 1 תרגול 2: מערכים, לולאות והתמודדות עם שגיאות מערכים Array: A fixed-length data structure for storing multiple values of the same type Example from last week: An array of odd numbers: Indices (start

More information

Lecture 1 Java SE Programming

Lecture 1 Java SE Programming Lecture 1 Java SE Programming presentation Java Programming Software App Development Assoc. Prof. Cristian Toma Ph.D. D.I.C.E/D.E.I.C Department of Economic Informatics & Cybernetics www.dice.ase.ro cristian.toma@ie.ase.ro

More information

הערה על הפתרון: בתנאי הקדם אין לבדוק שהמשחק לא השתנה. המתודה מוגדרת היטב ויש לה ערך החזרה למקרה זה.

הערה על הפתרון: בתנאי הקדם אין לבדוק שהמשחק לא השתנה. המתודה מוגדרת היטב ויש לה ערך החזרה למקרה זה. אוניברסיטת בן-גוריון מדור בחינות מספר נבחן: רשמו תשובותיכם בגיליון התשובות בלבד, תשובות מחוץ לגיליון לא יבדקו. שימו לב: על תשובות ריקות יינתן 20% מהניקוד. בהצלחה! תאריך הבחינה : 6.3.2017 שם המורה : ד"ר

More information

1 Short Answer (5 Points Each)

1 Short Answer (5 Points Each) 1 Short Answer (5 Points Each) 1. Write a declaration of an array of 300 strings. String strarray[] = new String[300];. Write a method that takes in an integer n as a parameter and returns one half of

More information

מבוא לתכנות ב- JAVA מעבדה 2

מבוא לתכנות ב- JAVA מעבדה 2 מבוא לתכנות ב- JAVA מעבדה 2 מה בתרגול טיפוסים פרימיטיביים המרות טיפוסים אופרטורים יחסיים ולוגיים משפט if-else בתרגול הקודם טיפוסים פרימיטביים לייצוג מספרים שלמים וממשיים ואופרטורים לפעולות בין מספרים.1

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A

More information